package com.wwj.study.mybatis.unit;


import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;

import java.util.Properties;


/**
 * @Author: wuweijun
 * @Date: 2018/12/12 20:40
 */

@Intercepts({@Signature(
        type= Executor.class,
        method = "commit",
        args = {boolean.class})})
//method 代表拦截的方法
//Executor 代表拦截的类
//args 这里面的类型要与method中的方法保持一致
public class ExamplePluginInsert implements Interceptor {

    public Object intercept(Invocation invocation) throws Throwable {



        System.out.println("---------------------------------");
        return invocation.proceed();
    }

    public Object plugin(Object o) {
        return Plugin.wrap(o,this);
    }

    public void setProperties(Properties properties) {

    }
}
